package br.com.almanach.jsf;

import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;

public class TestePhaseListener  implements PhaseListener{

    public void afterPhase(PhaseEvent pe) {
    }

    public void beforePhase(PhaseEvent pe) {
        if(pe.getPhaseId().equals(PhaseId.RESTORE_VIEW)){
           System.out.println("Processando Restore / Create View");
        }else if(pe.getPhaseId().equals(PhaseId.APPLY_REQUEST_VALUES)){
           System.out.println("Processando Apply Request Values");
        }else if(pe.getPhaseId().equals(PhaseId.PROCESS_VALIDATIONS)){
           System.out.println("Processando Validations");
        }else if(pe.getPhaseId().equals(PhaseId.UPDATE_MODEL_VALUES)){
           System.out.println("Processando Update Model Values");
        }else if(pe.getPhaseId().equals(PhaseId.INVOKE_APPLICATION)){
           System.out.println("Processando Invoke Application");
        }else if(pe.getPhaseId().equals(PhaseId.RENDER_RESPONSE)){
           System.out.println("Processando Render Response");
        }
    }

    public PhaseId getPhaseId() {
        return PhaseId.ANY_PHASE;
    }

}
